<template>
  <div id="PageControl">
    <el-button type="primary" @click="getPage($event)" id="up">上一页</el-button>
    <div>{{this.page}}</div>
    <el-button type="primary" @click="getPage($event)" id="down">下一页</el-button>
  </div>

</template>
<script>
export default {
  name: "PageControl",
  data(){
    return{
      page:1,
    }
  },
  methods:{
    getPage(e){
      let controlMessage=e.currentTarget.id//获取向上翻页或向下翻页
      if(controlMessage=='up'&&this.page!=1)
        this.page=this.page-1
      if(controlMessage=='down')
        this.page=this.page+1
      this.$EventBus.$emit('getPage',this.page)
    },
  }
}
</script>

<style scoped>
#PageControl{
  display:flex;
  margin-left: 450px;
}
</style>
